package cn.idietrade.idietradelogisticsmodule8011.service.impl;

import cn.idietrade.common.pojo.SecondGoods;
import cn.idietrade.common.pojo.SecondLogistics;
import cn.idietrade.idietradelogisticsmodule8011.mapper.SecondLogisticsMapper;
import cn.idietrade.idietradelogisticsmodule8011.service.SecondLogisticsService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zjy
 * @version 1.0
 * @createTime 2022-12-05 14:55
 * @description
 */

@Service
public class SecondLogisticsServiceImpl implements SecondLogisticsService {
    @Resource
    private SecondLogisticsMapper secondLogisticsMapper;
    @Override
    public int saveLogisticsInfo(SecondLogistics secondLogistics) {
        return secondLogisticsMapper.saveLogisticsInfo(secondLogistics);
    }


    @Override
    public PageInfo<SecondLogistics> queryLogisticss(Integer pageNum, Integer pageSize,Integer orderId) {
        if(pageNum==null||pageNum<=1){
            pageNum=1;
        }
        if(pageSize==null){
            pageSize=4;
        }
        PageHelper.startPage(pageNum,pageSize);
        PageInfo<SecondLogistics> pageInfo=new PageInfo<>(secondLogisticsMapper.queryLogisticss(orderId));
        return pageInfo;
    }
}
